:root {
  --yellow: #fbbf24;
  --yellow-light: rgba(251, 191, 36, 0.1);
  --purple: #8b5cf6;
  --purple-light: rgba(139, 92, 246, 0.1);
  --blue: #3b82f6;
  --blue-light: rgba(59, 130, 246, 0.1);
  --bg-white: #ffffff;
  --bg-light: #fafafa;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 6px;
  --font-mono: 'Monaco', monospace;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.2);
  --success-bg: #f0fff4;
  --success-text: #34c759;
  --error-bg: #fff0f0;
  --error-text: #ff3737;
  --line-numbers-width: 50px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, var(--yellow-light), var(--purple-light), var(--blue-light));
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'Noto Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

html {
  min-height: 100vh;
  overflow-x: hidden;
}

#root {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
}

.tools-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-bottom: 40px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  width: 100%;
  padding: 40px 0;
}

@media (max-width: 1200px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

.tool-card {
  position: relative;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%;
  border: none;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.8);
}

.tool-card.disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.tool-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-md);
}

.tool-card:nth-child(3n+1) {
  background: linear-gradient(135deg, var(--yellow-light) 0%, rgba(255,255,255,0.8) 100%);
}

.tool-card:nth-child(3n+2) {
  background: linear-gradient(135deg, var(--purple-light) 0%, rgba(255,255,255,0.8) 100%);
}

.tool-card:nth-child(3n+3) {
  background: linear-gradient(135deg, var(--blue-light) 0%, rgba(255,255,255,0.8) 100%);
}

@media (max-width: 768px) {
  .tool-card:nth-child(2n+1) {
    background: linear-gradient(135deg, var(--yellow-light) 0%, rgba(255,255,255,0.8) 100%);
  }
  
  .tool-card:nth-child(2n+2) {
    background: linear-gradient(135deg, var(--purple-light) 0%, rgba(255,255,255,0.8) 100%);
  }
}

@media (max-width: 375px) {
  .tool-card:nth-child(n) {
    background: linear-gradient(135deg, var(--yellow-light) 0%, rgba(255,255,255,0.8) 100%);
  }
  
  .tool-card:nth-child(2n) {
    background: linear-gradient(135deg, var(--purple-light) 0%, rgba(255,255,255,0.8) 100%);
  }
  
  .tool-card:nth-child(3n) {
    background: linear-gradient(135deg, var(--blue-light) 0%, rgba(255,255,255,0.8) 100%);
  }
}

.tool-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.tool-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 32px;
  color: white;
}

.tool-card:nth-child(3n+1) .tool-icon {
  background: linear-gradient(135deg, var(--yellow) 0%, #f59e0b 100%);
}

.tool-card:nth-child(3n+2) .tool-icon {
  background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 100%);
}

.tool-card:nth-child(3n+3) .tool-icon {
  background: linear-gradient(135deg, var(--blue) 0%, #2563eb 100%);
}

@media (max-width: 768px) {
  .tool-card:nth-child(2n+1) .tool-icon {
    background: linear-gradient(135deg, var(--yellow) 0%, #f59e0b 100%);
  }
  
  .tool-card:nth-child(2n+2) .tool-icon {
    background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 100%);
  }
}

@media (max-width: 375px) {
  .tool-card:nth-child(n) .tool-icon {
    background: linear-gradient(135deg, var(--yellow) 0%, #f59e0b 100%);
  }
  
  .tool-card:nth-child(2n) .tool-icon {
    background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 100%);
  }
  
  .tool-card:nth-child(3n) .tool-icon {
    background: linear-gradient(135deg, var(--blue) 0%, #2563eb 100%);
  }
}

.tool-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tool-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
  width: 100%;
}

.page-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--yellow) 0%, var(--purple) 50%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

/* Tool specific styles */
.tool-container {
  padding: 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.back-button {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--bg-light);
  transition: all 0.2s;
}

.back-button:hover {
  background: var(--purple-light);
  color: var(--purple);
}

.tool-title {
  font-size: 20px;
  color: var(--text-primary);
  margin: 0;
  font-weight: 500;
}

.tool-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.button-group {
  display: flex;
  gap: 8px;
  padding: 8px 48px;
}

.button-group .ant-btn {
  height: 32px !important;
  padding: 0 16px !important;
  font-size: 14px !important;
  border-radius: 6px !important;
  border: none !important;
  transition: all 0.2s !important;
  color: white !important;
}

.button-group .ant-btn:nth-child(1) {
  background: var(--yellow) !important;
}

.button-group .ant-btn:nth-child(2) {
  background: var(--purple) !important;
}

.button-group .ant-btn:nth-child(3) {
  background: var(--blue) !important;
}

.button-group .ant-btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.input-group {
  display: flex;
  gap: 32px;
  margin-top: 12px;
}

.input-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 600px;
}

.conversion-input {
  flex: 1;
  min-height: 280px !important;
  font-family: var(--font-mono) !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  padding: 16px 48px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  background: var(--bg-light) !important;
  resize: none !important;
  transition: all 0.2s !important;
}

.ant-btn {
  border-radius: var(--radius-md) !important;
  height: 44px !important;
  padding: 0 32px !important;
  font-weight: 500 !important;
  font-size: 15px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.ant-btn .anticon {
  font-size: 18px !important;
}

.ant-btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%) !important;
  border: none !important;
  color: white !important;
  transition: all 0.3s ease !important;
}

.ant-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
}

.ant-btn-default {
  background: white !important;
  border: 2px solid rgba(0, 0, 0, 0.1) !important;
}

.ant-btn-default:hover {
  color: var(--purple) !important;
  border-color: var(--purple) !important;
  background: var(--purple-light) !important;
}

.tool-card-white {
  border: none !important;
  border-radius: var(--radius-lg) !important;
  background: var(--bg-white) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05),
              0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  height: 100%;
  transition: all 0.3s ease !important;
}

.tool-card-white:hover {
  box-shadow: 0 0 0 2px var(--purple-light),
              0 8px 12px -1px rgba(0, 0, 0, 0.1),
              0 4px 6px -1px rgba(0, 0, 0, 0.06) !important;
}

.ant-card-head {
  border-bottom: none !important;
  padding: 20px 24px 0 !important;
}

.ant-card-head-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
}

.ant-card-body {
  padding: 20px 24px !important;
}

.ant-input {
  border-radius: var(--radius-md) !important;
  border: 2px solid rgba(0, 0, 0, 0.1) !important;
  transition: all 0.2s !important;
  margin-bottom: 20px !important;
  font-size: 15px !important;
  padding: 12px !important;
  resize: none !important;
}

.ant-input:hover {
  border-color: var(--purple) !important;
}

.ant-input:focus {
  border-color: var(--purple) !important;
  box-shadow: 0 0 0 3px var(--purple-light) !important;
}

.timestamp-tool {
  padding: 24px;
}

.timestamp-tool .section-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.timestamp-tool .label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.timestamp-tool .timestamp {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}

.timestamp-tool .current-timestamp-section {
  margin-bottom: 32px;
}

.timestamp-tool .conversion-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.timestamp-tool .conversion-block {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 24px;
}

.timestamp-tool .datetime-input {
  flex-wrap: wrap;
}

.timestamp-tool .result-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timestamp-tool .result {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.timestamp-tool .ant-input {
  font-family: var(--font-mono);
}

.timestamp-tool .ant-input[readonly] {
  background-color: #fff;
  cursor: text;
  color: var(--text-primary);
}

.json-tool {
  padding: 24px;
}

.json-tool .json-card {
  padding: 16px;
}

.json-tool .button-group {
  display: flex;
}

.json-tool .button-group .ant-space {
  gap: 12px !important;
}

.json-tool .json-editor-wrapper {
  position: relative;
  height: 400px;
  display: flex;
}

.json-tool .input-section {
  margin-top: 12px;
  margin-bottom: 24px;
}

.json-tool .line-numbers {
  min-width: var(--line-numbers-width);
  background: #f5f5f5;
  border: 1px solid #d9d9d9;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: #999;
  user-select: none;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}

.json-tool .line-numbers::-webkit-scrollbar {
  display: none;
}

.json-tool .line-numbers-inner {
  padding: 16px 0;
}

.json-tool .line-number {
  height: 21px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.json-tool .line-number .collapse-icon {
  color: #1677ff;
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}

.json-tool .line-number .collapse-icon:hover {
  background: #e6f4ff;
  border-radius: 2px;
}

.json-tool .line-number .number {
  text-align: right;
}

.json-tool .json-editor {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: var(--line-numbers-width);
  outline: none;
  cursor: text;
  border: 1px solid #d9d9d9;
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
  background: transparent;
  z-index: 1;
  color: transparent;
  caret-color: #000;
  overflow: auto;
  resize: none;
}

.json-tool .json-highlight-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: var(--line-numbers-width);
  overflow: hidden;
  pointer-events: none;
}

.json-tool .json-highlight {
  margin: 0 !important;
  padding: 16px !important;
  background: white !important;
  border: 1px solid #d9d9d9 !important;
  border-left: none !important;
  border-radius: 0 8px 8px 0 !important;
  font-family: var(--font-mono) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  height: 100% !important;
  overflow: visible !important;
  white-space: pre !important;
}

/* placeholder样式 */
.json-tool .json-editor:empty:before {
  content: attr(data-placeholder);
  color: #bfbfbf;
  font-family: var(--font-sans);
  position: absolute;
  pointer-events: none;
}

.json-tool .validation-message {
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.json-tool .validation-message.success {
  color: #52c41a;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
}

.json-tool .validation-message.error {
  color: #ff4d4f;
  background: #fff2f0;
  border: 1px solid #ffccc7;
}

.json-tool .ant-btn {
  min-width: 90px;
  border-radius: 6px;
}

/* 按钮颜色 - 提高优先级 */
.json-tool .button-group .format-btn.ant-btn-primary {
  background: #1677ff !important;
  border-color: #1677ff !important;
}

.json-tool .button-group .compress-btn.ant-btn-primary {
  background: #722ed1 !important;
  border-color: #722ed1 !important;
}

.json-tool .button-group .copy-btn.ant-btn-primary {
  background: #13c2c2 !important;
  border-color: #13c2c2 !important;
}

.json-tool .button-group .clear-btn.ant-btn {
  background: #ff4d4f !important;
  border-color: #ff4d4f !important;
  color: #fff !important;
}

/* 按钮悬停效果 */
.json-tool .button-group .ant-btn:hover {
  opacity: 0.85 !important;
}

.skip-chars-row {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 48px;
}

.skip-chars-row span {
  color: #666;
  font-size: 14px;
}

.skip-chars-input {
  width: 60px !important;
}

.conversion-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.conversion-container .ant-upload-list {
  width: 100%;
}

.conversion-container .ant-progress {
  margin: 16px 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .app-container {
    padding: 20px 12px;
  }

  .tool-container {
    padding: 20px 12px;
  }

  .tool-content {
    padding: 20px 16px;
  }

  .page-title {
    font-size: 24px;
  }

  .page-subtitle {
    font-size: 14px;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px 0;
  }

  .tool-card {
    padding: 16px;
  }

  .tool-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .tool-title {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .tool-description {
    font-size: 12px;
  }

  .input-group {
    flex-direction: column;
    gap: 16px;
  }

  .input-section {
    min-width: unset;
  }

  .conversion-input {
    min-height: 200px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }

  .button-group {
    padding: 8px 16px;
  }

  .button-group .ant-btn {
    padding: 0 12px !important;
    font-size: 12px !important;
  }

  .skip-chars-row {
    padding: 0 16px;
  }

  .skip-chars-row span {
    font-size: 12px;
  }

  .tool-header {
    margin-bottom: 16px;
  }

  .back-button {
    padding: 6px 12px;
    font-size: 12px;
  }

  .conversion-container {
    padding: 20px 16px;
  }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-card {
    padding: 12px;
  }

  .button-group {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .button-group .ant-btn {
    width: 100%;
  }

  .skip-chars-row {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.tool-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #ff4d4f;
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  z-index: 1;
  line-height: 1.5;
}
